<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JavaScript async / await</title>
</head>
<body>
  <p>等待超时</p>
<p id="demo"></p>
<script>
  async function myDisplay() {
    let myPromise = new Promise(function (myResolve, myReject) {
      setTimeout(function () {
        myResolve("I love You !!");
      }, 3000);
    });
    document.getElementById("demo").innerHTML = await myPromise;
  }
  myDisplay();
</script>
</body>
</html>